function Qim = function_Q(i,J,S,p,PIE)
    % 返回Q i m
    PIEx=size(PIE,1);%求PIE的情况数
    Qim=0;
    for ii = 1 : PIEx
        cell=1;
        for jj = 1 : J % 连乘
            cell =cell * nchoosek(S(i,jj),PIE(ii,jj)) * p(jj)^PIE(ii,jj) * (1-p(jj))^(S(i,jj)-PIE(ii,jj));%二项分布
        end
        Qim = Qim + cell;
    end
end
    
  


